package com.se.model;

import java.io.Serializable;
import java.text.DateFormat;
import java.text.ParseException;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class SessionUser  implements Serializable
{
  private static final long serialVersionUID = 3174095035503327908L;
  public static final String ATTRIBUTE_NAME = "separtnersSessonUser";
  protected String key;
  protected String id;
  protected String name;
  protected String nickname;
  protected String email;
  protected int level;
  protected boolean authenticatedUser;
  protected boolean administrator;
  protected Map map;
  protected List groups;

  public SessionUser()
  {
    this.map = new HashMap();
  }

  public SessionUser(String paramString1, String paramString2, String paramString3, String paramString4, String paramString5, int paramInt, Map paramMap)
  {
    this.key = paramString1;
    this.id = paramString2;
    this.name = paramString3;
    this.nickname = paramString4;
    this.email = paramString5;
    this.level = paramInt;
    this.map = paramMap;
  }

  public Object get(String paramString)
  {
    return this.map.get(paramString);
  }

  public String getString(String paramString)
  {
    if (this.map == null)
      return null;
    String str = null;
    Object localObject = this.map.get(paramString);
    if (localObject == null)
      return null;
    if ((localObject instanceof String))
      str = (String)localObject;
    else
      str = localObject.toString();
    return str;
  }

  public Date getDate(String paramString)
  {
    if (this.map == null)
      return null;
    Date localDate = null;
    Object localObject = this.map.get(paramString);
    if (localObject == null)
      return null;
    if ((localObject instanceof Date))
    {
      localDate = (Date)localObject;
    }
    else
    {
      DateFormat localDateFormat = DateFormat.getInstance();
      try
      {
        localDate = localDateFormat.parse(localObject.toString());
      }
      catch (ParseException localParseException)
      {
      }
    }
    return localDate;
  }

  public int getInt(String paramString)
  {
    if (this.map == null)
      return 0;
    int i = 0;
    Object localObject = this.map.get(paramString);
    if (localObject == null)
      return 0;
    if ((localObject instanceof Integer))
      i = ((Integer)localObject).intValue();
    else
      try
      {
        i = Integer.parseInt(localObject.toString());
      }
      catch (NumberFormatException localNumberFormatException)
      {
      }
    return i;
  }

  public long getLong(String paramString)
  {
    if (this.map == null)
      return 0L;
    long l = 0L;
    Object localObject = this.map.get(paramString);
    if (localObject == null)
      return 0L;
    if ((localObject instanceof Long))
      l = ((Long)localObject).longValue();
    else
      try
      {
        l = Long.parseLong(localObject.toString());
      }
      catch (NumberFormatException localNumberFormatException)
      {
      }
    return l;
  }

  public double getDouble(String paramString)
  {
    double d = 0.0D;
    if (this.map == null)
      return d;
    Object localObject = this.map.get(paramString);
    if (localObject == null)
      return d;
    if ((localObject instanceof Double))
      d = ((Double)localObject).longValue();
    else
      try
      {
        d = Double.parseDouble(localObject.toString());
      }
      catch (NumberFormatException localNumberFormatException)
      {
      }
    return d;
  }

  public void set(String paramString, Object paramObject)
  {
    this.map.put(paramString, paramObject);
  }

  public boolean isAdministrator()
  {
    return this.administrator;
  }

  public void setAdministrator(boolean paramBoolean)
  {
    this.administrator = paramBoolean;
  }

  public boolean isAuthenticatedUser()
  {
    return this.authenticatedUser;
  }

  public void setAuthenticatedUser(boolean paramBoolean)
  {
    this.authenticatedUser = paramBoolean;
  }

  public String getEmail()
  {
    return this.email;
  }

  public void setEmail(String paramString)
  {
    this.email = paramString;
  }

  public String getId()
  {
    return this.id;
  }

  public void setId(String paramString)
  {
    this.id = paramString;
  }

  public String getKey()
  {
    return this.key;
  }

  public void setKey(String paramString)
  {
    this.key = paramString;
  }

  public int getLevel()
  {
    return this.level;
  }

  public void setLevel(int paramInt)
  {
    this.level = paramInt;
  }

  public Map getMap()
  {
    return this.map;
  }

  public void setMap(Map paramMap)
  {
    this.map = paramMap;
  }

  public String getName()
  {
    return this.name;
  }

  public void setName(String paramString)
  {
    this.name = paramString;
  }

  public String getNickname()
  {
    return this.nickname;
  }

  public void setNickname(String paramString)
  {
    this.nickname = paramString;
  }

  public List getGroups()
  {
    return this.groups;
  }

  public void setGroups(List paramList)
  {
    this.groups = paramList;
  }
}
